<template>
    <view class="main">
        <LoadPage :show="show" />
        <Empty v-if="!dataList.length" />
        <view v-else class="item dispaly-just-between" v-for="item in dataList" :key="item" @click="skip(item)">
            <view class="left dispaly-center">
                <view class="avatar">
                    <image :src="item.avatar" mode="aspectFill" />
                </view>
                <view class="info">
                    <view class="name">{{ item.nickName }}</view>
                    <view class="address">{{ item.address ? item.address : '暂无地址' }}</view>
                </view>
            </view>
            <view class="right dispaly-center">
                <view class="price">￥{{ item.balance }}</view>
                <view class="icon dispaly-center">
                    <nut-icon size="13" custom-color="#777777" name="rect-right"></nut-icon>
                </view>
            </view>
        </view>
        <!-- <LoadMore :status="status" /> -->
    </view>
</template>

<script setup>
import { ref } from 'vue';
import { teamList } from '@/api/apiList'
import { onLoad } from '@dcloudio/uni-app';

// 获取团队列表
let show = ref(true)
const dataList = ref([])
const getTeamList = async () => {
    const res = await teamList()
    if (res.code == 200) {
        dataList.value = res.data
        show.value = false
    }
}

// 进入详情
const skip = (item) => {
    const { avatar, balance, address, nickName, userId } = item
    let data = JSON.stringify({
        avatar, address, balance, nickName, userId
    })
    uni.navigateTo({
        url: `/subPackage/mine/moneyDetail?data=${encodeURIComponent(data)}`
    })
}
onLoad(() => {
    getTeamList()
})
</script>
<style lang="scss" scoped>
.main {
    padding: 30rpx;

    .item:last-child {
        margin-bottom: 0;
    }

    .item {
        margin-bottom: 40rpx;

        .right {
            .price {
                font-family: PingFang-SC, PingFang-SC;
                font-weight: 500;
                font-size: 24rpx;
                color: #111111;
                margin-right: 20rpx;
            }
        }

        .left {
            .avatar {
                margin-right: 40rpx;

                image {
                    width: 100rpx;
                    height: 100rpx;
                    border-radius: 50rpx;
                }
            }

            .info {
                .name {
                    font-family: PingFang-SC, PingFang-SC;
                    font-weight: 500;
                    font-size: 24rpx;
                    color: #111111;
                }

                .address {
                    font-family: PingFang-SC, PingFang-SC;
                    font-weight: 500;
                    font-size: 22rpx;
                    color: #777777;
                }
            }
        }
    }
}
</style>